package com.example.echoewish.repository.network;

import com.example.echoewish.pojo.Comment;
import com.example.echoewish.repository.network.service.CommentService;
import com.example.echoewish.pojo.MyComment;
import com.example.echoewish.pojo.OthersComment;
import com.example.echoewish.util.ServiceCreator;

import org.jetbrains.annotations.NotNull;

import retrofit2.Callback;


public class CommentServiceNetwork {

    public static void publishNewComment(@NotNull Comment comment, Callback callback)
    {
        CommentService commentService=new ServiceCreator().create(CommentService.class);
        commentService.publishNewComment(comment.postId,comment.userId,comment.content,comment.time).enqueue(callback);
    }

    public static void deleteComment(@NotNull MyComment comment, Callback callback)
    {
        CommentService commentService=new ServiceCreator().create(CommentService.class);
        commentService.deleteComment(comment.postId,comment.userId,comment.content,comment.time).enqueue(callback);
    }

    public static void deleteComment(@NotNull OthersComment comment, Callback callback)
    {
        CommentService commentService=new ServiceCreator().create(CommentService.class);
        commentService.deleteComment(comment.postId,comment.userId,comment.content,comment.time).enqueue(callback);
    }

    public static void queryCommentByPostId(int postId,Callback callback)
    {
        CommentService commentService=new ServiceCreator().create(CommentService.class);
        commentService.queryCommentByPostId(postId).enqueue(callback);
    }

    public static void queryMyCommentByUserId(int userId,Callback callback)
    {
        CommentService commentService=new ServiceCreator().create(CommentService.class);
        commentService.queryMyCommentByUserId(userId).enqueue(callback);
    }

    public static void queryOthersCommentByUserId(int userId,Callback callback)
    {
        CommentService commentService=new ServiceCreator().create(CommentService.class);
        commentService.queryOthersCommentByUserId(userId).enqueue(callback);
    }
}
